﻿-- replace "{0}" with "domain\username" 
IF NOT EXISTS (SELECT * FROM master.dbo.syslogins WHERE loginname = N'{0}')
CREATE LOGIN [{0}] FROM WINDOWS
GO
CREATE USER [{0}] FOR LOGIN [{0}] WITH DEFAULT_SCHEMA=[dbo]
GRANT CONNECT TO [{0}]
GO